package com.example.myapplication;


import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;


import java.io.BufferedReader;
import java.io.InputStreamReader;

import org.json.JSONArray;
import org.json.JSONObject;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;



import java.io.*;
import java.util.Calendar;

public class MainActivity extends AppCompatActivity{
    private TextView dateTextView;
    private Button scheduleButton;
    private Button classroomSerchButton;
    private Button teacherSerchButton;
    private Button bt,bt1,bt2,bt3,bt4,bt5;
    @Override
    protected void onCreate(Bundle savedInstanceState) {


        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);//设置显示的内容。

        scheduleButton = (Button)findViewById(R.id.button11);
        classroomSerchButton = (Button)findViewById(R.id.button7);
        teacherSerchButton = (Button)findViewById(R.id.button8);



        scheduleButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent();
                i.setClass(MainActivity.this, ScheduleActivity.class);
                startActivity(i);

            }
        });

        classroomSerchButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent();
                i.setClass(MainActivity.this, ClassroomSerch.class);
                startActivity(i);
            }
        });
        teacherSerchButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent();
                i.setClass(MainActivity.this, TeacherSerch.class);
                startActivity(i);
            }
        });

        //        tv=this.findViewById(R.id.TextView);
        setMyDate();



    }
    private void setMyDate( ){
        dateTextView = this.findViewById(R.id.textView);
        Calendar calendar = Calendar.getInstance();
        String dateSting = "";
        String[] weekOfDays = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
        int weekNum = calendar.get(Calendar.DAY_OF_WEEK);
        dateSting = dateSting + weekOfDays[weekNum-1]+"\t";
        int myMonth = calendar.get(Calendar.MONTH)+1;
        int myday = calendar.get(Calendar.DAY_OF_MONTH);

        dateSting = dateSting + myMonth + "月"+myday+"日";
        dateTextView.setText(dateSting);
    }
}


